package com.yt.server.api;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import com.yt.server.api.action.IActionProxy;
import com.yt.server.api.event.IEventDispatcher;
import com.yt.server.api.event.IEventHandler;
import com.yt.server.api.event.IEventListener;
import com.yt.server.api.listeners.IConnectionListener;
import com.yt.server.comm.UUID;
import com.yt.server.messaging.Packet;

/**
 * 连接基础接口
 * 
 * @author 刘晶
 */
public interface IConnection extends IEventDispatcher, IEventHandler,
		IEventListener, ICastingAttributeStore {
	public boolean isConnected();

	public String getHost();

	public String getRemoteAddress();

	public List<String> getRemoteAddresses();

	public int getRemotePort();

	public String getPath();

	public long getSessionId();

	public IoSession getIoSession();

	public void setIoSession(IoSession ioSession);

	public String getClientId();

	public long getCreated();

	public UUID getGUID();

	public void setSate(int state);

	public int getState();

	public long getReadBytes();

	public long getWrittenBytes();

	public long getReadMessages();

	public long getWrittenMessages();

	public Map<String, Object> getConnectParams();

	public IConnectionListener getConnectionListener();

	public boolean ping(String ping);

	public int getLastPingTime();

	public IScope getScope();

	public void setScope(IScope scope);

	public IActionProxy getProxy();

	public void registerScope(IScope scope);

	public void unregisterScope(IScope scope);

	public Iterator<IScope> getScopes();

	public void destroy();

	public void write(Packet packet);

	public void write(IoBuffer buffer);
}